/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package core.threads.client.inGame;
import core.messages.client.inGame.Msg_Card_Draw;
import core.messages.client.inGame.Msg_Card_Draw_Phase_End;
import core.threads.client.Client_Public_Data;
import core.threads.client.Client_Public_MsgBox;
import core.threads.client.Client_Public_Thread;

/**
 *
 * @author Invince
 */
public class T_Client_Draw_Phase  extends Thread{
/*----------Attributs-------------------*/
//    protected boolean stop;
//    protected boolean suspend;

/*----------Public functions------------*/
    @Override
    public void run() {
        /**-----Init-----**/
        String name;
        synchronized(Client_Public_Data.semaMyInfo){
            name=Client_Public_Data.myInfo.getName();
        }
        /**-----Main-----**/
        boolean isBLCD;
            synchronized(Client_Public_Data.semaJudgeResult){
                isBLCD=Client_Public_Data.judgeResult.isBLCD();
        }
        if(!isBLCD){
            int nbCard=2;
            if(name.equals("周瑜")){nbCard=3;}
            Msg_Card_Draw msgCardDraw=new Msg_Card_Draw(name,"Server", nbCard);
            Client_Public_MsgBox.msgBox_Client_Send_Msg.offer(msgCardDraw);
        }
        Msg_Card_Draw_Phase_End msgCardDrawPhaseEnd=new Msg_Card_Draw_Phase_End(name, "Server");
        Client_Public_MsgBox.msgBox_Client_Send_Msg.offer(msgCardDrawPhaseEnd);
        /**----End-----**/
        synchronized(Client_Public_Data.semaIsCastOver){
            Client_Public_Data.isCastOver=false;//重置 isCastOver
        }
        Client_Public_Thread.tClientCastPhase=new T_Client_Cast_Phase();
        Client_Public_Thread.tClientCastPhase.start();
    }

//    public void stopT(){
//        synchronized(this){
//            this.stop=true;
//        }
//    }
//
//    public void suspendT(){
//        synchronized(this){
//            this.suspend=true;
//        }
//    }
//
//    public void resumeT(){
//        synchronized(this){
//            this.suspend=false;
//        }
//    }
/*----------Private functions-----------*/
/*----------Constructor-----------------*/
    public T_Client_Draw_Phase() {
        synchronized(this){
//            this.stop=false;
//            this.suspend=false;
        }
    }
/*----------Gets and sets---------------*/
}
